package com.tepth.busfix.main.partsearch;

import com.tepth.busfix.bean.reponse.SearchPartResult;
import com.tepth.busfix.network.ApiModel;
import com.tepth.busfix.network.Network;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by TMVPHelper on 2017/03/17
 */
public class PartSearchModel implements PartSearchContract.Model {

    @Override
    public Observable<ApiModel<SearchPartResult>> searchPart(String authKey, String name) {
        return Network.getApiService().searchPart(authKey, name).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable<ApiModel<SearchPartResult>> getCommonComponents(String authKey, int count) {
        return Network.getApiService().commonComponent(authKey, count).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}